/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package Current;

import java.io.Serializable;

/**
 * @author Fork
 */
public enum Race implements Serializable, Cloneable {

    ELF("Defense", 5),
    HUMAN("Defense", 5),
    UNDEAD("Offense", 5),
    GOBLIN("Defense", 5);

    private final String boostedStat;
    private final int boost;

    Race(String boostedStat, int boost) {
        this.boostedStat = boostedStat;
        this.boost = boost;
    }

    int getBoost() {
        return boost;
    }

    String getBoostedStat() {
        return boostedStat;
    }

    public static Race getELF() {
        return ELF;
    }

    public static Race getGOBLIN() {
        return GOBLIN;
    }

    public static Race getHUMAN() {
        return HUMAN;
    }

    public static Race getUNDEAD() {
        return UNDEAD;
    }

    boolean isElf() {
        return this == ELF;
    }

    boolean isHuman() {
        return this == HUMAN;
    }

    boolean isUndead() {
        return this == UNDEAD;
    }

    boolean isGoblin() {
        return this == GOBLIN;
    }

    public int offenseBoost() {
        if (this.getBoostedStat().equals("Offense")) {
            return this.getBoost();
        }
        return 0;
    }

    public int defenseBoost() {
        if (this.getBoostedStat().equals("Defense")) {
            return this.getBoost();
        }
        return 0;
    }

    public int spyOffenseBoost() {
        if (this.getBoostedStat().equals("Spy Offense")) {
            return this.getBoost();
        }
        return 0;
    }

    public int spyDefenseBoost() {
        if (this.getBoostedStat().equals("Spy Defense")) {
            return this.getBoost();
        }
        return 0;
    }

    @Override
    public String toString() {
        if (this.isElf()) {
            return "Elf";
        }
        if (this.isHuman()) {
            return "Human";
        }
        if (this.isUndead()) {
            return "Undead";
        }
        if (this.isGoblin()) {
            return "Goblin";
        } else {
            return "error";
        }
    }
}
